]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dnd: Prevent dividing by zero when calculating the scale factor
authorMario Sanchez Prada <mario@endlessm.com>
Fri, 30 Jun 2017 01:22:42 +0000 (01:22 +0000)
committerMario Sanchez Prada <mario@endlessm.com>
Fri, 22 Sep 2017 14:50:07 +0000 (15:50 +0100)
This ensures that we snap back to the correct size when the
source actor has been scaled to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=787901

js/ui/dnd.js

index 64c1eb51bac2219cfebfead8b5c384cf6b14fe84..a64915bc82997de1542a737940f5cd512f249fab 100644 (file)
@@ -531,7 +531,7 @@ var _Draggable = new Lang.Class({
             // Snap the clone back to its source
             [x, y] = this._dragActorSource.get_transformed_position();
             let [sourceScaledWidth, sourceScaledHeight] = this._dragActorSource.get_transformed_size();
-            scale = this._dragActor.width / sourceScaledWidth;
+            scale = sourceScaledWidth ? this._dragActor.width / sourceScaledWidth : 0;
         } else if (this._dragOrigParent) {
             // Snap the actor back to its original position within
             // its parent, adjusting for the fact that the parent